import request from '../../../request.js'

// 查询对应的医疗工作人员信息
function selectUserById(query) {
  return request({
    url: '/system/user/list',
    method: 'GET',
    data:
    {
    	userName: query,
    },
	header: {
		Authorization: uni.getStorageSync('token'),
		'Content-Type': 'application/x-www-form-urlencoded'
	},
  })
}

// 查询个人信息
function selectPersonMine(personId) {
  return request({
    url: '/fuw/person/' + personId,
    method: 'GET',
	header: {
		Authorization: uni.getStorageSync('token')
	},
  })
}

// 查询所有符合要求消息记录列表
function listMessageAll(query) {
  return request({
    url: '/api/wx/chat/list/message',
    method: 'GET',
    data:
    {
    	userName: query,
    },
    header: {
    	Authorization: uni.getStorageSync('token')
    },
  })
}

// 新增消息记录
function addMessage(dataForm) {
  return request({
    url: '/fuw/message/add',
    method: 'POST',
    data: dataForm,
	header: {
		Authorization: uni.getStorageSync('token'),
		'Content-Type': 'application/x-www-form-urlencoded'
	},
  })
}

// 修改消息记录
function updateMessage(dataForm) {
  return request({
    url: '/fuw/message/update',
    method: 'POST',
    data: dataForm,
	header: {
		Authorization: uni.getStorageSync('token'),
		'Content-Type': 'application/x-www-form-urlencoded'
	},
  })
}

//一定要声明暴露函数，可以被引用 
module.exports = {
	selectUserById,
	selectPersonMine,
	listMessageAll,
	addMessage,
	updateMessage
}